package com.ziyun.erp.modules.goods.dao;

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import com.ziyun.erp.modules.goods.entity.GoodsAttributeEntity;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.ziyun.erp.modules.goods.entity.GoodsOptionEntity;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 商品属性表
 * 
 * @author xueqz
 * @email 
 * @date 2018-08-20 09:57:04
 */
@Service("goodsAttributeDao")
public interface GoodsAttributeDao extends BaseMapper<GoodsAttributeEntity> {

    String getAttributeNamesByAttributeIds(@Param("attributeIds") String attributeIds);

    String getAttributeNamesByOptionIds(@Param("optionIds")String optionIds);

    String getCraftNamesByCraftOptionIds(@Param("craftOptionIds")String craftOptionIds);

    List<GoodsAttributeEntity> getAttributeType(@Param("templateId") Integer templateId,@Param("type") String type);

    Long saveAttribute(GoodsAttributeEntity goodsAttribute);

    List<GoodsAttributeEntity> getTemplateAttribute(@Param("categoryId") Integer categoryId);

    void fagDelAttribute(@Param("attributeIds") String attributeIds);

    List<GoodsAttributeEntity> selectAttributes(Long goodsId);

    List<GoodsAttributeEntity> selectCraft(Long goodsId);

    List<Map<String,String>> selectListByOptionIds(@Param("optionIds")String optionIds);

    List<GoodsAttributeEntity> selectByIds(@Param("attributeIds") String attributeIds);

    List<GoodsAttributeEntity> getCountAttributeByCategoryId(@Param("categoryId") Integer categoryId);

    Long getCraftAttributeByGoodsId(@Param("goodsId") Long goodsId);

    List<GoodsAttributeEntity>  queryNewPage(Pagination resultPage, @Param("params") Map<String,Object> params);

    List<Map<String,Object>> selectGoodsCraftConfig();

    List<GoodsOptionEntity> getPrivateOptionByAttributeIds(@Param("attributeIds") String attributeIds,@Param("sellerId") Long sellerId);
}
